import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../home/views/home_view.dart';

class BottomTabController extends GetxController {
  final currentIndex = 0.obs; /// 用于控制默认加载的tabs选项
  PageController pageController = Get.arguments != null
      ? PageController(initialPage: Get.arguments["initialPage"])
      : PageController(initialPage:0);

  final List<Widget> pages =  [
    const HomeView(),
    // const MinePage(),
    // ShopCartView(),
    // MineView(),

    // const Center(
    //   child: Text("时大声打"),
    // )
  ];

  @override
  void onInit() {
    if(Get.arguments != null){
      currentIndex.value = Get.arguments["initialPage"];
      update();
    }
    super.onInit();
  }

  @override
  void onClose() {
    super.onClose();
  }

  void setCurrentIndex(index) {
    currentIndex.value = index;
    update();
  }
}
